openwrt 安装swoole

您所在的位置:网站首页 斐讯h1 拆解 openwrt 安装swoole

openwrt 安装swoole

2023-03-28 08:03| 来源: 网络整理| 查看: 265

本人所写的博客都为开发之中遇到问题记录的随笔,主要是给自己积累些问题。免日后无印象,如有不当之处敬请指正(欢迎进扣群 24849632 探讨问题);

打算在在openwrt下安装PHP扩展swoole,下面记录相关的过程:

swoole在PECL地址为:http://pecl.php.net/package/swoole

先下载最新的软件包swoole-4.4.16.tgz ,并移动openwrt/dl目录下

root# cd openwrt

root# mkdir -p package/utils/php7

root# cp feeds/packages/lang/php7-pecl-redis/ package/utils/php7/php7-pecl-swoole -rf

root# sha256sum dl/swoole-4.4.16.tgz

   04864e1b705c2b62198a5f3890dd3c23f95a4787c97f3c1b086f0367bdaf9a87  dl/swoole-4.4.16.tgz

root# vim package/utils/php7/php7-pecl-swoole/Makefile

# # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk PECL_NAME:=swoole PECL_LONGNAME:=Bindings for the libswoole library PKG_VERSION:=4.4.16 PKG_RELEASE:=16 PKG_HASH:=04864e1b705c2b62198a5f3890dd3c23f95a4787c97f3c1b086f0367bdaf9a87 PKG_NAME:=php7-pecl-swoole PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=http://pecl.php.net/get/ PKG_MAINTAINER:=shen zhe (developer)\ Han Tianfeng (lead)\ QiHao ChenCao PKG_LICENSE:=Apache2.0 PKG_LICENSE_FILES:=LICENSE PKG_BUILD_DEPENDS:=php7 PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk include $(TOPDIR)/feeds/packages/lang/php7/pecl.mk CONFIGURE_ARGS+= "$(STAGING_DIR)/usr" $(eval $(call PECLPackage,swoole,$(PECL_LONGNAME),+libstdc++,15)) $(eval $(call BuildPackage,$(PKG_NAME)))

:wq

root# ./scripts/feeds update -p local

root# ./scripts/feeds install -p local

root# make meunconfig

sel swoole 选中SWOOLE插件

 

root# make V=s

编译出现如下错误

make[4]: Leaving directory '/home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16' touch /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.built rm -rf /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole.installed /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole mkdir -p /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole install -d -m0755 /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole/usr/lib/php install -m0755 /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/modules/swoole.so /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole/usr/lib/php/ install -d -m0755 /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole/etc/php7 echo "extension=swoole.so" > /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole/etc/php7/15_swoole.ini touch /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole.installed mkdir -p /home/bruce/MT7260/openwrt/staging_dir/target-mipsel_24kc_musl/root-ramips/stamp SHELL= flock /home/bruce/MT7260/openwrt/tmp/.root-copy.flock -c 'cp -fpR /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/.pkgdir/php7-pecl-swoole/. /home/bruce/MT7260/openwrt/staging_dir/target-mipsel_24kc_musl/root-ramips/' touch /home/bruce/MT7260/openwrt/staging_dir/target-mipsel_24kc_musl/root-ramips/stamp/.php7-pecl-swoole_installed mkdir -p /home/bruce/MT7260/openwrt/bin/targets/ramips/mt7620/packages /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/ipkg-mipsel_24kc/php7-pecl-swoole/CONTROL /home/bruce/MT7260/openwrt/staging_dir/target-mipsel_24kc_musl/pkginfo install -d -m0755 /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/ipkg-mipsel_24kc/php7-pecl-swoole/usr/lib/php install -m0755 /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/modules/swoole.so /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/ipkg-mipsel_24kc/php7-pecl-swoole/usr/lib/php/ install -d -m0755 /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/ipkg-mipsel_24kc/php7-pecl-swoole/etc/php7 echo "extension=swoole.so" > /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/ipkg-mipsel_24kc/php7-pecl-swoole/etc/php7/15_swoole.ini find /home/bruce/MT7260/openwrt/build_dir/target-mipsel_24kc_musl/pecl-php7/swoole-4.4.16/ipkg-mipsel_24kc/php7-pecl-swoole -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf Package php7-pecl-swoole is missing dependencies for the following libraries: libstdc++.so.6 Makefile:37: recipe for target '/home/bruce/MT7260/openwrt/bin/packages/mipsel_24kc/base/php7-pecl-swoole_4.4.16-16_mipsel_24kc.ipk' failed make[3]: *** [/home/bruce/MT7260/openwrt/bin/packages/mipsel_24kc/base/php7-pecl-swoole_4.4.16-16_mipsel_24kc.ipk] Error 1 make[3]: Leaving directory '/home/bruce/MT7260/openwrt/package/utils/php7/php7-pecl-swoole' time: package/utils/php7/php7-pecl-swoole/compile#200.25#22.59#214.86 package/Makefile:111: recipe for target 'package/utils/php7/php7-pecl-swoole/compile' failed make[2]: *** [package/utils/php7/php7-pecl-swoole/compile] Error 2 make[2]: Leaving directory '/home/bruce/MT7260/openwrt' package/Makefile:107: recipe for target '/home/bruce/MT7260/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile' failed make[1]: *** [/home/bruce/MT7260/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.package_compile] Error 2 make[1]: Leaving directory '/home/bruce/MT7260/openwrt' /home/bruce/MT7260/openwrt/include/toplevel.mk:225: recipe for target 'world' failed make: *** [world] Error 2 root#

解决办法:

这个问题,我尝试解决花了两天的时间,通过查看Makefile,发现是因为openwrt在BulidPackage时会将所有的“+”号正则为空字符,因此最后添加的依赖变成了libstdc, 导致在打包为IPK时不成功,修改相应的依赖信息为libstdcpp,成功完成编译

# # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk PECL_NAME:=swoole PECL_LONGNAME:=Bindings for the libswoole library PKG_VERSION:=4.4.16 PKG_RELEASE:=16 PKG_HASH:=04864e1b705c2b62198a5f3890dd3c23f95a4787c97f3c1b086f0367bdaf9a87 PKG_NAME:=php7-pecl-swoole PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz PKG_SOURCE_URL:=http://pecl.php.net/get/ PKG_MAINTAINER:=shen zhe (developer)\ Han Tianfeng (lead)\ QiHao ChenCao PKG_LICENSE:=Apache2.0 PKG_LICENSE_FILES:=LICENSE PKG_BUILD_DEPENDS:=php7 PKG_BUILD_DIR:=$(BUILD_DIR)/pecl-php7/$(PECL_NAME)-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/nls.mk include $(TOPDIR)/feeds/packages/lang/php7/pecl.mk # CONFIGURE_ARGS+= \ # --enable-openssl \ # --enable-http2 \ # --enable-sockets \ # --enable-debug \ # --enable-debug-log $(eval $(call PECLPackage,swoole,$(PECL_LONGNAME),+libstdcpp,15)) $(eval $(call BuildPackage,$(PKG_NAME)))

欣喜之时,赶紧将生成的镜像写入了开发板并创建了相应的测试程序



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3